The present invention relates to process affinity and workload balancing routines employed within multi-processor computer systems.
Multi-user computers, e.g., servers, mainframes, midrange computers, and the like, are typically designed to be shared by many individuals in various ways to execute one or more tasks. Furthermore, even some single-user computers may require the performance of multiple concurrent tasks. In order to improve system performance, a number of computers, and in particular many multi-user computers, are designed to incorporate multiple central processing units (CPUs), or processors to share the overall workloads of such computers.
In many environments, the CPUs operate substantially independent from one another. Nonetheless, even in such environments, some degree of synchronization and communication between CPU""s is usually required. Synchronization activities, however, require at least some system overhead, and thus can lower the amount of system resources that are available for performing useful tasks in a computer. Therefore, a great deal of effort has been directed toward minimizing the amount of synchronization required between multiple CPUs in a multi-processor computer.
One type of synchronization required in many multi-processor computers involves maintaining coherence between local caches that are dedicated to various CPUs in a multi-processor computer. In particular, in many multi-processor computers, all of the CPUs share a common memory. However, for performance concerns, each CPU maintains a local cache of most-frequently-accessed memory locations that it can access much more quickly than the main computer memory bank. However, the process of keeping the data in the cache of each CPU coherent, that is, consistent with the data in the cache memories of all of the other CPUs in the computer, can significantly reduce the efficiency of the computer.
One mechanism for improving the performance of multi-processor computer systems available in a number of conventional multi-tasking operating systems is xe2x80x9cprocess affinityxe2x80x9d. That is, particular processes can be coerced (xe2x80x9chardxe2x80x9d affinity) or given a suggestion (xe2x80x9csoftxe2x80x9d affinity) to run on a particular CPU or set of CPUs in a given computer controlled by the operating system. Doing so minimizes the activity required to maintain cache coherence since it ensures that each process runs on the same CPU all of the time, so the data required by a given process typically does not need to be moved from the cache of one CPU to another.
Several methods for applying process affinity are known. Static process affinity methods assign to each individual process at some point in its lifetime a permanent affinity to a CPU. However, it has been found that it is difficult to maintain a balanced use of all of the CPU""s in a computer using static process allocation, since processes come and go, and the CPU requirements for such processes often change over time.
Application-specific process affinity methods permit an application that creates one or more processes to set the affinity of each of its processes as it sees fit. Such methods, however, have only limited utility unless the application is not required to share computer resources with any other application, since typically an application is not permitted to access other applications to determine the utilization of system resources by other applications in a computer. Application-specific process affinity therefore is typically required to assume that a particular application is the only application currently active on a computer.
Static system partitioning process affinity methods are employed in multi-processor computer systems shared by many applications. Each application is given affinity to a fixed subset of CPUs within the computer, typically using a manually-operated software tool. The specific set of CPUs assigned to each application is typically determined by the average CPU resource need of the application, at least as of the particular point in time at which the tool is used. However, given that the allocation is static in nature, this mechanism tends to produce non-optimal results if the group of applications being run does not exhibit a consistent CPU usage pattern over time. Therefore, if usage patterns vary from those assumed as of the time the tool was last used, application requirements may change and cause unbalanced loads across the available processors.
Static user process affinity methods are employed in multi-processor computer systems shared by many users. This process affinity method assigns all processes created by a given user the same affinity. As with static system partitioning methods, allocations established through static user affinity methods are static in nature making it difficult to maintain a balanced use of all of the CPUs in the system as the group of users and their processes change over time.
Another method for applying process affinity, referred to as static system partitioning with static user management, finds application in multi-processor computer systems shared by many applications and by many users. Utilizing this method of process affinity, each application is given affinity to a fixed subset of CPUs within the computer system, while all users share the remaining CPUs. Additionally, all processes created by a given user are given the same affinity. This method, combining both static system partitioning and static user affinity mechanisms, has the shortcomings associated with both of those mechanisms.
In each of the aforementioned instances, CPU or processor allocation is static in nature, and does not take into account variations in usage patterns. Assumptions about usage patterns made when resources are allocated often may not be valid at later points in time. Therefore, a significant need exists in the art for a manner of establishing and then maintaining efficient utilization of CPUs in a multi-processor computer in spite of inconsistent CPU usage patterns that vary over time.
The invention addresses the above described and other problems associated with the prior art by providing an apparatus, computer-readable medium and method that group multiple user and server processes executing in a multi-processor computer into xe2x80x9ccollectionsxe2x80x9d such that all of the processes in a given collection share the same processor affinity, and thus are assigned to a common set of processors available in the multi-processor computer. User processes, i.e., processes associated with application programs such as word processors or mail readers that have an instance dedicated to each computer system user, are organized into a user collection. Server processes, i.e., processes associated with application programs such as databases and electronic mail post offices that typically run as a single instance to support all users, are organized into one or more server collections.
User processes are further grouped within the user collection into one or more user sessions, each session includes one or more processes associated with a particular user. All of the processes in a given user session share the same processor affinity, and thus are assigned to a common subset of processors within the set of processors assigned to the user collection.
Moreover, new server collections and user sessions are dynamically created responsive to the creation of new processes in such a computer whenever it is determined that such new processes should not be assigned to any existing collections or sessions resident in the computer. As such, the allocation of processors to a server collection or user session may occur dynamically in response to process creation, thereby enabling processor allocation to take into account current computer usage patterns. Dynamic processor allocation in this manner consequently has the capability of more efficiently allocating resources than would otherwise be possible using conventional static allocation strategies in instances where resource usage patterns are inconsistent and/or variable over time.
These and other advantages and features, which characterize the invention, are set forth in the claims annexed hereto and forming a further part hereof. However, for a better understanding of the invention, and of the advantages and objectives attained through its use, reference should be made to the Drawings, and to the accompanying descriptive matter, in which there is described exemplary embodiments of the invention.